home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.text;
-
- import com.sun.java.swing.event.ChangeEvent;
- import com.sun.java.swing.event.ChangeListener;
- import com.sun.java.swing.event.EventListenerList;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
- import java.util.Enumeration;
-
- public class StyleContext$NamedStyle implements Style, Serializable {
- // $FF: synthetic field
- StyleContext this$0;
- protected EventListenerList listenerList;
- protected ChangeEvent changeEvent;
- private transient AttributeSet attributes;
-
- // $FF: synthetic method
- public StyleContext$NamedStyle(StyleContext this$0, String name, Style parent) {
- this.this$0 = this$0;
- this.listenerList = new EventListenerList();
- this.changeEvent = null;
- this.attributes = this$0.getEmptySet();
- if (name != null) {
- this.setName(name);
- }
-
- if (parent != null) {
- this.setResolveParent(parent);
- }
-
- }
-
- // $FF: synthetic method
- public StyleContext$NamedStyle(StyleContext this$0, Style parent) {
- this(this$0, (String)null, parent);
- this.this$0 = this$0;
- }
-
- // $FF: synthetic method
- public StyleContext$NamedStyle(StyleContext this$0) {
- this.this$0 = this$0;
- this.listenerList = new EventListenerList();
- this.changeEvent = null;
- this.attributes = this$0.getEmptySet();
- }
-
- public String toString() {
- return "NamedStyle:" + this.getName() + " " + this.attributes;
- }
-
- public String getName() {
- return this.isDefined(StyleConstants.NameAttribute) ? (String)this.getAttribute(StyleConstants.NameAttribute) : null;
- }
-
- public void setName(String name) {
- if (name != null) {
- this.addAttribute(StyleConstants.NameAttribute, name);
- }
-
- }
-
- public void addChangeListener(ChangeListener l) {
- EventListenerList var10000 = this.listenerList;
- Class var10001 = StyleContext.class$com$sun$java$swing$event$ChangeListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.ChangeListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- StyleContext.class$com$sun$java$swing$event$ChangeListener = var10001;
- }
-
- var10000.add(var10001, l);
- }
-
- public void removeChangeListener(ChangeListener l) {
- EventListenerList var10000 = this.listenerList;
- Class var10001 = StyleContext.class$com$sun$java$swing$event$ChangeListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.ChangeListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- StyleContext.class$com$sun$java$swing$event$ChangeListener = var10001;
- }
-
- var10000.remove(var10001, l);
- }
-
- protected void fireStateChanged() {
- Object[] listeners = this.listenerList.getListenerList();
-
- for(int i = listeners.length - 2; i >= 0; i -= 2) {
- Object var10000 = listeners[i];
- Class var10001 = StyleContext.class$com$sun$java$swing$event$ChangeListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.ChangeListener");
- } catch (ClassNotFoundException var3) {
- throw new NoClassDefFoundError(((Throwable)var3).getMessage());
- }
-
- StyleContext.class$com$sun$java$swing$event$ChangeListener = var10001;
- }
-
- if (var10000 == var10001) {
- if (this.changeEvent == null) {
- this.changeEvent = new ChangeEvent(this);
- }
-
- ((ChangeListener)listeners[i + 1]).stateChanged(this.changeEvent);
- }
- }
-
- }
-
- public int getAttributeCount() {
- return this.attributes.getAttributeCount();
- }
-
- public boolean isDefined(Object attrName) {
- return this.attributes.isDefined(attrName);
- }
-
- public boolean isEqual(AttributeSet attr) {
- return this.attributes.isEqual(attr);
- }
-
- public AttributeSet copyAttributes() {
- StyleContext$NamedStyle a = new StyleContext$NamedStyle(this.this$0);
- a.attributes = this.attributes.copyAttributes();
- return a;
- }
-
- public Object getAttribute(Object attrName) {
- return this.attributes.getAttribute(attrName);
- }
-
- public Enumeration getAttributeNames() {
- return this.attributes.getAttributeNames();
- }
-
- public boolean containsAttribute(Object name, Object value) {
- return this.attributes.containsAttribute(name, value);
- }
-
- public boolean containsAttributes(AttributeSet attrs) {
- return this.attributes.containsAttributes(attrs);
- }
-
- public AttributeSet getResolveParent() {
- return this.attributes.getResolveParent();
- }
-
- public void addAttribute(Object name, Object value) {
- StyleContext context = this.this$0;
- this.attributes = context.addAttribute(this.attributes, name, value);
- this.fireStateChanged();
- }
-
- public void addAttributes(AttributeSet attr) {
- StyleContext context = this.this$0;
- this.attributes = context.addAttributes(this.attributes, attr);
- this.fireStateChanged();
- }
-
- public void removeAttribute(Object name) {
- StyleContext context = this.this$0;
- this.attributes = context.removeAttribute(this.attributes, name);
- this.fireStateChanged();
- }
-
- public void removeAttributes(Enumeration names) {
- StyleContext context = this.this$0;
- this.attributes = context.removeAttributes(this.attributes, names);
- this.fireStateChanged();
- }
-
- public void removeAttributes(AttributeSet attrs) {
- StyleContext context = this.this$0;
- if (attrs == this) {
- this.attributes = context.getEmptySet();
- } else {
- this.attributes = context.removeAttributes(this.attributes, attrs);
- }
-
- this.fireStateChanged();
- }
-
- public void setResolveParent(AttributeSet parent) {
- if (parent != null) {
- this.addAttribute(StyleConstants.ResolveAttribute, parent);
- } else {
- this.removeAttribute(StyleConstants.ResolveAttribute);
- }
-
- }
-
- private void writeObject(ObjectOutputStream s) throws IOException {
- s.defaultWriteObject();
- StyleContext.writeAttributeSet(s, this.attributes);
- }
-
- private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
- s.defaultReadObject();
- this.attributes = SimpleAttributeSet.EMPTY;
- StyleContext.readAttributeSet(s, this);
- }
- }
-